package com.gopay.common.domain.cbrmb;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.gopay.common.domain.BaseEntity;

/**
 * 跨境人民币划拨订单日志
 * <p>主键索引为:CB_RMB_ALLOCATION_LOGS_SEQ</p>
 * <p>已对gopayOrderId建立索引,根据createTime创建分区,分区粒度为自然月</p>
 * @author junjie.ge 
 */
@Entity
@Table(name = "CB_RMB_ALLOCATION_ORDER_LOGS")
public class CbRmbAllocationOrderLogs extends BaseEntity {
    private static final long serialVersionUID = 7670969771493363388L;
    private Long id; //主键
    private String gopayOrderId; //划拨订单ID,非空
    private String contents; //日志内容,500字符以内
    private String optId; //操作员ID,非空
    private Date createTime; //创建时间,非空
    private Date updateTime; //更新时间
    private String optType;
    private String descriptions;

    @Id
    @Column(name = "ID", nullable = false, unique = true, length = 20)
    @GeneratedValue(generator = "cbRmbAllocationLogsSeq", strategy = GenerationType.SEQUENCE)
    @SequenceGenerator(name = "cbRmbAllocationLogsSeq", sequenceName = "CB_RMB_ALLOCATION_LOGS_SEQ")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "GOPAY_ORDER_ID", length = 20, nullable = false)
    public String getGopayOrderId() {
        return gopayOrderId;
    }

    public void setGopayOrderId(String gopayOrderId) {
        this.gopayOrderId = gopayOrderId;
    }

    @Column(name = "CONTENTS", length = 500)
    public String getContents() {
        return contents;
    }

    public void setContents(String contents) {
        this.contents = contents;
    }

    @Column(name = "OPT_ID", length = 20, nullable = false)
    public String getOptId() {
        return optId;
    }

    public void setOptId(String optId) {
        this.optId = optId;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "CREATE_TIME", nullable = false)
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "UPDATE_TIME")
    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    /**
     * @see com.gopay.common.constants.cbrmb.AllocationOptType
     * @return the optType
     */
    @Column(name = "OPT_TYPE", length=20)
    public String getOptType() {
        return optType;
    }

    /**
     * @param optType the optType to set
     * @see com.gopay.common.constants.cbrmb.AllocationOptType
     */
    public void setOptType(String optType) {
        this.optType = optType;
    }

    /**
     * @return the descriptions
     */
    @Column(name = "DESCRIPTIONS", length=2000)
    public String getDescriptions() {
        return descriptions;
    }

    /**
     * @param descriptions the descriptions to set
     */
    public void setDescriptions(String descriptions) {
        this.descriptions = descriptions;
    }

}
